{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}

<div class="p-page">
	<form class="layui-form gg-form-bar border-t border-x" lay-filter="barsearchform">
		<div class="layui-input-inline" style="width:120px">
			<select name="cate_id">
				<option value="">培训类型</option>
				{volist name = ":get_base_data('train_cate')" id="vo"}
				<option value="{$vo.id}">{$vo.title}</option>
				{/volist}
			</select>
		</div>
		<div class="layui-input-inline" style="width:100px">
			<select name="status">
				<option value="">培训状态</option>
				<option value="2">已发布</option>
				<option value="3">培训中</option>
				<option value="4">已培训</option>
			</select>
		</div>
		<div class="layui-input-inline" style="width:300px">
			<input type="text" name="keywords" placeholder="关键字" class="layui-input" autocomplete="off" />
		</div>
		<div class="layui-input-inline" style="width:150px">
			<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="table-search"><i class="layui-icon layui-icon-search mr-1"></i>搜索</button>
			<button type="reset" class="layui-btn layui-btn-reset" lay-filter="table-reset">清空</button>
		</div>
	</form>
	<table class="layui-hide" id="table_train" lay-filter="table_train"></table>
</div>

<script type="text/html" id="toolbarDemo">
  <div class="layui-btn-group">
  	<h3>学习培训</h3>
  </div>
</script>

{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
	const moduleInit = ['tool','tablePlus'];
	function gouguInit() {
		var table = layui.tablePlus, tool = layui.tool;
		
		layui.pageTable = table.render({
			elem: "#table_train"
			,title: '培训计划列表'
			,toolbar: "#toolbarDemo"
			,url: "/train/train/mylist"
			,page: true
			,limit: 20
			,cellMinWidth: 80
			,height: 'full-114'
			,cols: [[
				{field:'id',width:80, title: 'ID号', align:'center'}
				,{field:'status', title: '状态',width:80,align:'center',templet: function(d){
					var html1='<span class="red">未发布</span>';
					var html2='<span class="green">已发布</span>';
					var html3='<span class="blue">培训中</span>';
					var html4='<span class="yellow">已培训</span>';
					if(d.status==1){
						return html1;
					}
					else if(d.status==2){
						return html2;
					}
					else if(d.status==3){
						return html3;
					}
					else if(d.status==4){
						return html4;
					}
				}}
				,{field:'title',title: '线下培训名称',minWidth:200}
				,{field:'cate',title: '所属分类',width:90,align:'center'}
				,{field:'start_time',title: '培训周期',width:180,align:'center',templet: function(d){
					return d.start_time_str +' 至 '+ d.end_time_str;
				}}
				,{field:'duration',title: '总时长(天)',width:90,align:'center'}
				,{field:'types_train',title: '培训对象',minWidth:200}
				,{field:'admin_name',title: '创建人',width:90,align:'center'}
				,{field:'create_time', title: '创建时间',width:150,align:'center'}
				,{width:120,fixed:'right',title: '操作', align:'center',ignoreExport:true,templet: function(d){
					var html='';
					var btn1='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详细</a>';
					var btn2='<a class="layui-btn layui-btn-xs" lay-event="appraise">培训评价</a>';
					html = '<div class="layui-btn-group">'+btn1+btn2+'</div>';
					return html;
				}}
			]]
		});
			
		table.on('tool(table_train)',function (obj) {
			var checkStatus = table.checkStatus(obj.config.id); //获取选中行状态
			var data = obj.data;
			if (obj.event === 'view') {
				tool.side("/train/train/view?id="+data.id);
				return;
			}
			if (obj.event === 'appraise') {
				tool.side("/train/train/myappraise?id="+data.id);
				return;
			}
		});
	}
</script>
{/block}
<!-- /脚本 -->